// pages/tabber/repair/repair.js
const request = require('../../../utils/request.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabPanelstyle: 'display:flex;justify-content:center;align-items:center;',
    bx:[
      {id:1,name:'咖啡机咖啡机1',jia:'200',ya:"200",bian:"001",zt:"未报修",dl:"删除",sc:"我要报修",img:'/static/img/sp.png', url:"/pages/worepair/wore"},
      {id:2,name:'咖啡机咖啡机1',jia:'200',ya:"200",bian:"001",zt:"报修中",sc:"确认完成",img:'/static/img/sp2.png'},
      {id:3,name:'咖啡机咖啡机1',jia:'200',ya:"200",bian:"001",zt:"已完成",dl:"删除",img:'/static/img/sp3.png'},
    ],
  },
  methods: {
    onTabsChange(event) {
      console.log(`Change tab, tab-panel value is ${event.detail.value}.`);
    },

    onTabsClick(event) {
      console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
    },
  },
  goscan(){
    wx.navigateTo({
      url: '/pages/scan/scan',
    })
    // wx.scanCode({
    //   success: (res) => {
    //     console.log(res.result);
    //   },
    //   fail: (err) => {
    //     console.error(err);
    //   },
    //   complete: () => {
    //     console.log('扫描完成');
    //   }
    // });
  },
  // 报修列表
  bxlist(){
    const that = this;
    request.wxRequest(
      "repair/list",
      function (err, data) {
        console.log(data.data.list)
        if (err) {
          // 失败；
        } else {
          that.setData({
            // bxli: data.data.list
          });
        }
      }
    ),
    'GET'
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.bxlist()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})